package com.example.demo.school.controllers;

import com.example.demo.school.models.StudentType;
import com.example.demo.school.repositories.StudentTypeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(value = "/student-types")
public class StudentTypeController {

    @Autowired
    private StudentTypeRepository studentTypeRepository;

    @ResponseBody
    @RequestMapping(value = "", method = RequestMethod.GET)
    public List<StudentType> index() {
        List<StudentType> list = studentTypeRepository.findAll();
        return list;
    }
}
